package com.songtai.action.admin.gsjj;

import java.util.List;

import com.songtai.action.SongtaiActionSupport;
import com.songtai.po.PhotoObj;
import com.songtai.po.PublicObj;
import com.songtai.service.PublicObjService;
import com.songtai.service.TeamEliteService;
import com.songtai.util.PageBean;

/**
 * 团队精英
 * 
 * @author lx
 * 
 */
public class TeatEliteAction extends SongtaiActionSupport {

	private static final long serialVersionUID = 3932457379727273271L;

	private PageBean pageBean;

	private int currentPage = 1;

	private String ids;

	private TeamEliteService teamEliteService;

	private String url = "redirect.htm?nodeid=8";

	private PhotoObj obj;

	private String id;

	private String nodeid;

	private PublicObj pub;

	private List<PublicObj> qq;

	private PublicObjService publicObjService;

	public void setPublicObjService(PublicObjService publicObjService) {
		this.publicObjService = publicObjService;
	}

	public PublicObj getPub() {
		return pub;
	}

	public void setPub(PublicObj pub) {
		this.pub = pub;
	}

	/**
	 * 分页获取信息
	 */
	public String getAllTeams() throws Exception {
		if (null == pageBean) {
			pageBean = new PageBean();
		}
		// 设置统计总条数HQL
		pageBean.setCountHql("select count(id) from PhotoObj as p where nid = "
				+ nodeid);
		// 设置查询所有实体HQL
		pageBean.setEntiesHql("from PhotoObj as p where nid = " + nodeid +" order by p.insertDate desc");
		// 设置开始查询条数
		pageBean.setStartIndex((currentPage - 1) * 10);
		// 设置查询多少条
		pageBean.setEndIndex(10);
		pageBean.setCurrentPage(currentPage);
		teamEliteService.findPageTeams(pageBean);
		return SUCCESS;
	}

	/**
	 * 删除信息
	 * 
	 * @return
	 * @throws Exception
	 */
	public String delTeams() throws Exception {
		teamEliteService.delTeamElities(ids);
		return SUCCESS;
	}

	/**
	 * 添加信息
	 * 
	 * @return
	 * @throws Exception
	 */
	public String addTeam() throws Exception {
		teamEliteService.saveTeam(obj);
		return SUCCESS;
	}

	/**
	 * 查询详情
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findDesc() throws Exception {
		obj = teamEliteService.findDesc(id);
		return SUCCESS;
	}

	/**
	 * 前台跳转到设计师详细
	 * 
	 * @return
	 * @throws Exception
	 */
	public String teamDesc() throws Exception {
		qq = publicObjService.getObjsByNid("23");
		obj = teamEliteService.findDesc(id);
		return SUCCESS;
	}

	/**
	 * 前台跳转到设计师列表
	 */
	public String teams() throws Exception {
		if (null == pageBean) {
			pageBean = new PageBean();
		}
		// 设置统计总条数HQL
		pageBean.setCountHql("select count(id) from PhotoObj as p where nid = "
				+ nodeid);
		// 设置查询所有实体HQL
		pageBean.setEntiesHql("from PhotoObj as p where nid = " + nodeid);
		// 设置开始查询条数
		pageBean.setStartIndex((currentPage - 1) * 2);
		// 设置查询多少条
		// pageBean.setEndIndex(3);
		pageBean.setCurrentPage(currentPage);
		pageBean.setEndIndex(2);
		teamEliteService.findPageTeams(pageBean);
		pub = publicObjService.getObjByNid("21");
		qq = publicObjService.getObjsByNid("23");
		return SUCCESS;
	}

	public PageBean getPageBean() {
		return pageBean;
	}

	public void setPageBean(PageBean pageBean) {
		this.pageBean = pageBean;
	}

	public void setTeamEliteService(TeamEliteService teamEliteService) {
		this.teamEliteService = teamEliteService;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public PhotoObj getObj() {
		return obj;
	}

	public void setObj(PhotoObj obj) {
		this.obj = obj;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getNodeid() {
		return nodeid;
	}

	public void setNodeid(String nodeid) {
		this.nodeid = nodeid;
	}

	public List<PublicObj> getQq() {
		return qq;
	}

	public void setQq(List<PublicObj> qq) {
		this.qq = qq;
	}

}
